﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public static class ButtonExtension
{
    /// <summary>
    /// 拓展添加点击方法
    /// </summary>
    /// <param name="button"></param>
    /// <param name="uIDelegate"></param>
    public static void AddClickMethod(this Button button, EventTriggerListener.UIDelegate uIDelegate)
    {
        EventTriggerListener.GetListener(button.gameObject).onClick += uIDelegate;
    }

    /// <summary>
    /// 拓展添加进入方法
    /// </summary>
    /// <param name="button"></param>
    /// <param name="uIDelegate"></param>
    public static void AddEnterMethod(this Button button, EventTriggerListener.UIDelegate uIDelegate)
    {
        EventTriggerListener.GetListener(button.gameObject).onEnter += uIDelegate;
    }
    /// <summary>
    /// 拓展添加退出方法
    /// </summary>
    /// <param name="button"></param>
    /// <param name="uIDelegate"></param>
    public static void AddExitMethod(this Button button, EventTriggerListener.UIDelegate uIDelegate)
    {
        EventTriggerListener.GetListener(button.gameObject).onExit += uIDelegate;
    }
    /// <summary>
    /// 拓展添加抬起方法
    /// </summary>
    /// <param name="button"></param>
    /// <param name="uIDelegate"></param>
    public static void AddUpMethod(this Button button, EventTriggerListener.UIDelegate uIDelegate)
    {
        EventTriggerListener.GetListener(button.gameObject).onUp += uIDelegate;
    }

    /// <summary>
    /// 拓展添加按下方法
    /// </summary>
    /// <param name="button"></param>
    /// <param name="uIDelegate"></param>
    public static void AddDownMethod(this Button button, EventTriggerListener.UIDelegate uIDelegate)
    {
        EventTriggerListener.GetListener(button.gameObject).onDown += uIDelegate;
    }
    


}
